<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>安装程序 - MAOMAO-OA管理系统 v2.0</title>
<meta http-equiv="x-ua-compatible" content="ie=7" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="main">
	<div class="pmain">
		<dl class="setpbox t1">
			<dt> MAOMAO-OA管理系统 v2.0 安装程序</dt>
			<dd>
				<ul>
					<li class="succeed">许可协议</li>
					<li class="now">环境检测</li>
					<li>参数配置</li>
					<li>完成安装</li>
				</ul>
			</dd>
		</dl>
	</div>
	<div class="pmain">
		<div class="title"><h3>服务器信息</h3></div>
		<table width="900" border="0" align="center" cellpadding="0" cellspacing="0" class="twbox">
			<tr>
				<th width="300" align="center"><strong>参数</strong></th>
				<th><strong>值</strong></th>
			</tr>
			<tr>
					<td><strong>服务器域名</strong></td>
					<td><?php echo $_SERVER['HTTP_HOST'];?></td>
			</tr>
			<tr>
					<td><strong>服务器操作系统</strong></td>
					<td><?PHP echo PHP_OS; ?></td>
			</tr>
			<tr>
					<td><strong>服务器解译引擎</strong></td>
					<td><?php echo $_SERVER['SERVER_SOFTWARE'];?></td>
			</tr>
			<tr>
					<td><strong>PHP版本</strong></td>
					<td><?PHP echo PHP_VERSION; ?></td>
			</tr>
			<tr>
					<td><strong>系统安装目录</strong></td>
					<td><?php error_reporting(0);echo $_SERVER[DOCUMENT_ROOT];?></td>
			</tr>
		</table>
    <div class="title"><h3>系统环境检测</h3></div>
		<div style="padding:2px 8px 0px; line-height:33px; height:23px; overflow:hidden; color:#666;">
			系统环境要求尽量满足下列所有条件，否则系统部份功能将无法使用。
		</div>
		<table width="726" border="0" align="center" cellpadding="0" cellspacing="0" class="twbox">
			<tr>
				<th width="200" align="center"><strong>需开启的变量或函数</strong></th>
				<th width="80"><strong>要求</strong></th>
				<th width="400"><strong>实际状态</strong></th>
			</tr>
			<tr>
					<td>allow_url_fopen</td>
					<td align="center">On </td>
					<td><?php echo function_exists (allow_url_fopen)?"是":"否";?></td>
			</tr>
			<tr>
					<td>safe_mode</td>
					<td align="center">Off</td>
					<td><?php echo function_exists (safe_mode)?"是":"否";?></td>
			</tr>
			
			<tr>
					<td>GD 支持 </td>
					<td align="center">On</td>
					<td><?php echo function_exists (imagecreate)?"是":"否";?></td>
			</tr>
			<tr>
					<td>MySQL 支持</td>
					<td align="center">On</td>
					<td><?php echo function_exists (mysql_close)?"是":"否";?></td>
			</tr>
		</table>
		
		
		<div class="title"><h3>目录权限检测</h3></div>
		<div style="padding:2px 8px 0px; line-height:33px; height:23px; overflow:hidden; color:#666;">
			系统要求必须满足下列所有的目录权限全部可读写的需求才能使用。
		</div>
		<table width="726" border="0" align="center" cellpadding="0" cellspacing="0" class="twbox">
			<tr>
				<th align="center"><strong>目录名</strong></th>
				<th align="center"><strong>读取权限</strong></th>
				<th align="center"><strong>写入权限</strong></th>
			</tr>
			<tr>
              <td align="center">../Home</td>
			  <?php
			      $dir = "../Home";
				  $is_write = file_put_contents("{$dir}/1.txt","AAA");
				  if($is_write){
					 echo "<td align='center'><font color=green>可读</font></td>"; 
					 echo "<td align='center'><font color=green>可写</font></td>";  			 
					 unlink("{$dir}/1.txt");
				  }else{
					 echo "<td align='center'><font color=red>不可读</font></td>"; 
					 echo "<td align='center'><font color=red>不可写</font></td>";  
				  }
			  ?>
            </tr> 
            
            <tr>
              <td align="center">../Public</td>
			  <?php
			      $dir = "../Public";
				  $is_write = file_put_contents("{$dir}/1.txt","AAA");
				  if($is_write){
					 echo "<td align='center'><font color=green>可读</font></td>"; 
					 echo "<td align='center'><font color=green>可写</font></td>";  			 
					 unlink("{$dir}/1.txt");
				  }else{
					 echo "<td align='center'><font color=red>不可读</font></td>"; 
					 echo "<td align='center'><font color=red>不可写</font></td>";  
				  }
			  ?>
            </tr> 
            
            <tr>
			  <?php
			    $current_dir = "../Public";
			    $dir = opendir($current_dir);
				while(false!==($file = readdir($dir))){
				     if($file!="."&&$file!=".."){
						 $is_write = file_put_contents("{$current_dir}/{$file}/1.txt","AAA");
						 echo "<tr>";
						 echo "<td  align='center'>{$current_dir}/{$file}</td>";
						 if($is_write){
							 
							 echo "<td align='center'><font color=green>可读</font></td>"; 
					         echo "<td align='center'><font color=green>可写</font></td>";  			 
					 		 unlink("{$current_dir}/{$file}/1.txt");  
						 }else{
							 echo "<td align='center'><font color=red>不可读</font></td>"; 
					 	     echo "<td align='center'><font color=red>不可写</font></td>";  
						 }
						 echo "</tr>";
					 }
				}
				closedir($dir);
				  
			  ?>
            </tr>
            
             <tr>
			  <?php
			    $current_dir = "../Home";
			    $dir = opendir($current_dir);
				while(false!==($file = readdir($dir))){
				     if($file!="."&&$file!=".."){
						 $is_write = file_put_contents("{$current_dir}/{$file}/1.txt","AAA");
						 echo "<tr>";
						 echo "<td  align='center'>{$current_dir}/{$file}</td>";
						 if($is_write){
							 
							 echo "<td align='center'><font color=green>可读</font></td>"; 
					         echo "<td align='center'><font color=green>可写</font></td>";  			 
					 		 unlink("{$current_dir}/{$file}/1.txt");  
						 }else{
							 echo "<td align='center'><font color=red>不可读</font></td>"; 
					 	     echo "<td align='center'><font color=red>不可写</font></td>";  
						 }
						 echo "</tr>";
					 }
				}
				closedir($dir);
				  
			  ?>
            </tr>  
		</table>
		
		<div class="btn-box">
			<input type="button" class="btn-back" value="上一步" onclick="window.location.href='index.php';" />
			<input type="button" class="btn-next" value="下一步" onclick="window.location.href='step-3.php';" />
		</div>
	</div>
</div>
</body>
</html>
